<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
    <title>simple html parser</title>
</head>
<body>
    <p>simple html parser</p>

    <script type="text/javascript" src="./simplehtmlparser.js"></script>
    <script type="text/javascript">
        var parser = new SimpleHtmlParser();
        var html = '<div id="app">\n<p v-show="show">hello parser</p>\n<!--my-comment-->\n</div>';
        console.log(html)

        // 处理器
        var handler = {
            startElement: function (sTagName, oAttrs) {
                console.log(sTagName, oAttrs)
            },
            endElement: function (sTagName) {
                console.log(sTagName, 'end')
            },
            characters: function (s) {
                console.log(s, 'characters')
            },
            comment: function (s) {
                console.log(s, 'comment')
            }
        };
        // parse
        parser.parse(html, handler);
    </script>
</body>
</html>